import request from '@/utils/request'
/**
 * 获取总权限列表
 * @param {*} pageSize
 * @returns
 */
export const getResourceListAPI = (pageSize) => {
  // debugger
  return request({
    url: '/resource/tree',
    method: 'GET',
    params: { pageSize }
  })
}
/**
 * 根据角色id获取用户对资源权限
 * @param {*} pageSize
 * @param {*} roleId
 * @returns
 */
// /resource/tree?pageSize=1000&roleId=1683878974045945857
export const getRoleResourceAPI = (pageSize, roleId) => {
  // debugger
  return request({
    url: '/resource/tree',
    method: 'GET',
    params: { pageSize, roleId }
  })
}
/**
 * 分配资源
 * @param {*} data
 * @returns
 */
export const assignResourceAPI = (data) => {
  return request({
    url: '/v1/role/assignResource',
    method: 'POST',
    data: data
  })
}
